package com.xuz.spring01.demo02;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @user 65453
 * @date 2024/10/21 20:57
 */
public class Test01 {
    public static void main(String[] args) {

        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
//        StudentBean studentBean = (StudentBean)context.getBean("studentBean");
//        System.out.println(studentBean);

        // 当用户使用容器本身时，可以加上&符号,返回FactoryBean本身，以此来区分FactoryBean产生的实例对象和FactoryBean本身
//        StudentBean studentBean = (StudentBean)context.getBean("&studentBean");
//        studentBean.study();

        TeacherBean teacherBean = (TeacherBean) context.getBean("studentBean");
        teacherBean.teach();
    }
}
